package ch.randstand.terror.xmlsocketclient
{
	
	import flash.events.Event;
	import flash.display.Sprite;
	

	public class XMLSocketClientObject extends Sprite
	{
		
		private var circle	: Sprite	= new Sprite();
		
		private var color	: uint		= 0;
		private var id		: Number;
		
		public function XMLSocketClientObject( _id : Number = 0, _color : uint = 0 )
		{
			this.color = _color;
			addEventListener( Event.ADDED_TO_STAGE, init );
		}
		
		private function init( event : Event ) : void
		{
			if( this.color == 0 )
			{
				
				var c : int = int( Math.random() * 3 );
				
				switch( c )
				{
					
					case 0:
					
						this.color = 0xFF0000;
						break;
					
					case 1:
					
						this.color = 0x00FF00;
						break
					
					case 2:
					
						this.color = 0x0000FF;
						break
					
				}
			}
			
			circle.graphics.beginFill( this.color );
			circle.graphics.drawCircle( 0, 0, 10 );
			
			this.id = Math.random();
			
			addChild( circle );
			
		}
		
		public function getColor() : uint
		{
			return this.color;
		}
		
		public function getID() : Number
		{
			return this.id;
		}
		
	}
}